package com.limbo.showapp.presenter;

import com.limbo.showapp.base.BasePresenter;
import com.limbo.showapp.bean.BannerBean;
import com.limbo.showapp.model.BannerModel;
import com.limbo.showapp.rxHttp.HttpObserver;
import com.limbo.showapp.view.IHttpView;

/**
 * Created by wangqi on 2018/9/4.
 */

public class BannerPresenter extends BasePresenter<IHttpView,BannerModel> {

    @Override
    protected BannerModel getModel() {
        return  new BannerModel();
    }

    public void getBanner() {
        mModel.getBanner(new HttpObserver<BannerBean>() {
            @Override
            protected void onHttpError(Throwable e) {
                if (getView() != null)
                    getView().onError(e.getMessage());
            }

            @Override
            protected void onHttpSuccess(BannerBean bean) {
                if (getView() != null)
                    getView().onSuccess(bean);
            }
        });
    }
}
